package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.SelectInspectorBean;
import com.xuxin.nantai.contract.SelectDetailUpdateContract;
import com.xuxin.nantai.model.SelectDetailUpdateModel;

/**
 * Created by xu_xin
 * Created on 2020.06.17 0017
 */
public class SelectDetailUpdatePresenter implements SelectDetailUpdateContract.Presenter {
    private SelectDetailUpdateModel model;
    private SelectDetailUpdateContract.View view;

    public SelectDetailUpdatePresenter(SelectDetailUpdateContract.View view) {
        model = new SelectDetailUpdateModel();
        this.view = view;
    }

    @Override
    public void getInspector(String HID) {
        if (null != model) {
            model.getInspector(this, HID);
        }
    }

    @Override
    public void save(String LoginName,
                     String UserName,
                     String Guid,
                     String DID,
                     String HID,
                     String ProductName,
                     String ProductCode,
                     String DefectDes,
                     String DefectNum) {
        if (null != model) {
            model.save(this,
                     LoginName,
                     UserName,
                     Guid,
                     DID,
                     HID,
                     ProductName,
                     ProductCode,
                     DefectDes,
                     DefectNum);
        }
    }

    @Override
    public void onSuccess(SelectInspectorBean selectInspectorBean) {
        if (null != view) {
            view.onSuccess(selectInspectorBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}